#pragma once


#include "HashTable2.h"

namespace chen
{
	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:

		typedef typename hash_bucket::HashTable<K, K, SetKeyOfT>::const_iterator iterator;
		typedef typename hash_bucket::HashTable<K, K, SetKeyOfT>::const_iterator const_iterator;

		pair<iterator, bool> insert(const K& key)
		{
			pair<typename  hash_bucket::HashTable<K, K, SetKeyOfT>::iterator, bool> it = _t.insert(key);
			return pair<iterator, bool>(it.first, it.second);
		}

		bool erase(const K& key)
		{
			return _t.erase(key);
		}

		bool find(const K& key)
		{
			return _t.find(key);
		}

		iterator begin()
		{
			return _t.begin();
		}

		iterator end()
		{
			return _t.end();
		}

		const_iterator begin() const
		{
			return _t.begin();
		}

		const_iterator end() const
		{
			return _t.end();
		}

	private:
		hash_bucket::HashTable<K, K, SetKeyOfT> _t;
	};
}